import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: `/category/list/${query.page}/${query.limit}/${query.pid}`,
    method: 'get',
    params: query
  })
}

export function fetchLazyList(pid) {
  return request({
    url: `/category/list/${pid}`,
    method: 'get'
  })
}

export function fetchCategory(id) {
  return request({
    url: '/category/detail',
    method: 'get',
    params: { id }
  })
}

export function createCategory(data) {
  return request({
    url: '/category/create',
    method: 'post',
    data
  })
}

export function updateCategory(data) {
  return request({
    url: '/category/update',
    method: 'post',
    data
  })
}

export function deleteCategory(data) {
  return request({
    url: '/category/delete',
    method: 'post',
    data
  });
}
